package com.zuul.component;

import com.netflix.zuul.ZuulFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.cloud.sleuth.Tracer;

/** 日志 */
public class LoggerZuulFilterPost extends ZuulFilter {
    @Autowired
    Tracer tracer;

    @Override
    public  String filterType(){
        return FilterConstants.POST_TYPE;
    }
    @Override
    public  int filterOrder(){
        return 900;
    }
    @Override
    public boolean shouldFilter(){
        return true;
    }

    @Override
    public Object run(){
        tracer.addTag("operator","name");
        System.out.println(tracer.getCurrentSpan().traceIdString());

        return null;
    }
}
